AWSS3PutObject
Type
command
Summary
Upload an object
Syntax
AWSS3PutObject <pBucket>,<pObject>,<pPayload>,<pFile>,<pCustomHeaders>,<pCallback>
Description
The caller of this command will be sent the callback message on completion with two parameters:
- the request ID
- the server response which should be empty
- an error message if one occurred
The message is sent before the tsNet connection is closed so it is possible to access the recieved headers using the tsNetRetrHeaders function
For futher details about this API including values for custom headers see the AWS S3 REST API Documentation
If a file parameter is specified a temporary encoded version of the file will be created containing signed file binary chunks before the upload. The temporary file is deleted when the upload is complete. For very large files some consideration will beed to be given to available disk space.
Parameters
Name | Type | Description |
---|---|---|
pBucket | The name of a bucket | |
pObject | The name (key) of the object | |
pPayload | The data of the object. Required if pFile is empty. | |
pFile | A file path to read the object data directly from. Using this option will avoid having the entire object loaded into memory locally. Required if pPayload is empty. | |
pCustomHeaders | Use this array to specify additional request headers. For example
you may specify a pre-canned ACL by setting the
| |
pCallback | A command name to be sent on completion with the server reponse. |
Examples
local tCustomHeaders
put "public-read" into tCustomHeaders["x-amz-acl"]
AWSS3PutObject "mybucket", "myobject", tData, "", tCustomHeaders, "putObjectCallback"
put it into tRequestID
on putObjectCallback pRequestID, pResult, pError
if pError is not empty then
answer pError
end if
end putObjectCallback
Related
library: tsNet
function: tsNetGetStatus, tsNetRetrHeaders